<extend name="Public/base"/>

<block name="body">
  <!-- 标题 -->
  <div class="main-title">
    <h2>运费模板</h2>
  </div>

  <div class="cf">
    <div class="fl">
      <a class="btn" href="{:U('DeliveryTpl/add')}">新 增</a>
      <button class="btn ajax-post confirm" target-form="ids" url="{:U('DeliveryTpl/setStatus',array('status'=>-1))}">删 除</button>
      <a class="btn" href="{:U('index')}">刷 新</a>（点击"刷新"按钮显示全部信息。）
    </div>
    <if condition="!IS_SUPPLIER && $lists_supplier">
      <!-- 高级搜索 -->
      <form action="{:U()}" method="GET" id="J_search_form">
        <div class="search-form fr cf">
          <div class="sleft">
            <select name="supplier_id">
              <option value="all">请选择供应商</option>
              <option value="0">自营</option>
              <volist name="lists_supplier" id="vo">
                <option value="{$vo.supplier_id}">{:get_short($vo['name'],8)}</option>
              </volist>
            </select>
          </div>
        </div>
      </form>
    </if>
  </div>

  <!-- 数据表格 -->
  <div class="data-table">
    <table>
      <thead>
        <tr>
          <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
          <th>ID</th>
          <if condition="!IS_SUPPLIER"><th>供应商</th></if>  
          <th>模板名称</th>
          <th>快递公司名称</th>
          <th>发货时间</th>
          <th>计价方式</th>
          <th>详细内容</th>
          <th>排序</th>
          <th>状态</th>
          <th>添加时间</th>
          <th width="125">操作</th>
        </tr>
      </thead>
      <tbody>
        <notempty name="lists">
          <volist name="lists" id="vo">
            <tr class="status_trclass_{$vo.status}">
              <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
              <td><a href="{:U('edit?id='.$vo['id'])}">{$vo.id}</a></td>
              <if condition="!IS_SUPPLIER">            
                <td>
                  {$vo.supplier_id|get_supplier_text}
                </td>
              </if>
              <td><a href="{:U('edit?id='.$vo['id'])}">{$vo.name}</a></td>
              <td>{$vo.company}</td>
              <td>{$vo.send_date}</td>
              <eq name="vo['price_type']" value="1">
              <td>按件数</td>
              <else/>
              <td>按重量</td>
              </eq>
              <td>{$vo.express_start}<eq name="vo.price_type" value="1">件<else/>kg</eq>内{$vo.express_postage}元，每增加{$vo.express_plus}<eq name="vo.price_type" value="1">件<else/>kg</eq>加{$vo.express_postageplus}元</td>    
              <td><input class="J_ajax_updatefield text input-mini" type="text" data-action="{:U('setFieldValue')}" data-id="{$vo.id}" name="sort" value="{$vo['sort']}" title="数字越小越靠前"></td>
              <td>{$vo.status_text}</td>
              <td>{$vo.create_time|time_format}</td>
              <td>
                <if condition="$vo.status eq 1">
                  <a href="{:U('setStatus?status=0&ids='.$vo['id'])}" class="ajax-get">[禁用]</a>
                  <else/>
                  <a href="{:U('setStatus?status=1&ids='.$vo['id'])}" class="ajax-get">[启用]</a>
                </if>
                <a href="{:U('edit?id='.$vo['id'])}">[编辑]</a>
                <!--<a href="{:U('del?ids='.$vo['id'])}" class="confirm ajax-get">[删除]</a>-->
                <a href="{:U('setStatus?status=-1&ids='.$vo['id'])}" class="confirm ajax-get">[删除]</a>
              </td>
            </tr>
          </volist>
        <else/>
          <tr><td colspan="9" class="text-center"> 暂无快递模板!  <a href="{:U('DeliveryTpl/add')}" class="btn btn-mini">&plus;立即添加</a></td></tr>
        </notempty>
      </tbody>
    </table> 
  </div>

  <!-- 分页 -->
  <div class="page">
    {$_page}
  </div>
</block>

<block name="script">
  <script type="text/javascript">
    //导航高亮
    highlight_subnav("{:U('DeliveryTpl/index')}");
    Core.setValue('supplier_id', '{:I('get.supplier_id', 'all')}');
  </script>
</block>